angular.module('home.controllers', ['ionic'])  //主页指令

.controller('HotCtrl', function($rootScope,$scope,Chats,$ionicLoading) { 
	$scope.isShow = false;
	$scope.sta = 200;
	$scope.data ="from=qianqian&version=2.1.0&method=baidu.ting.radio.getCategoryList&format=json";
	$scope.hotList = [];
	var dat = new Date();
	var w_dat = dat.getDate();
	$scope.w_time = w_dat; 
	$scope.loadPro = function(){
		Chats.music($scope.data).then(function(data){
			console.log(data)
			$scope.hotList = data.data.result;	
		})		
	}
	$scope.w_traVideoImg = [];
	$scope.w_traVideoName = [];
	$scope.w_chan = []
	$scope.w_loveVideo = function(e,ev,c){
//		console.log(e)
//		console.log(ev)
		if($scope.w_traVideoImg.indexOf(e) ==-1){			
		  $scope.w_traVideoImg.unshift(e)
		}else if($scope.w_traVideoImg.length>10){
			$scope.w_traVideoImg.unshift(e)
			$scope.w_traVideoImg.pop()
		}
		if($scope.w_traVideoName.indexOf(ev) ==-1){			
		  $scope.w_traVideoName.unshift(ev)
		}else if($scope.w_traVideoName.length>10){
			$scope.w_traVideoName.unshift(ev)
			$scope.w_traVideoName.pop()
		}
		if($scope.w_chan.indexOf(c) ==-1){			
		  $scope.w_chan.unshift(c)
		}else if($scope.w_chan.length>10){
			$scope.w_chan.unshift(c)
			$scope.w_chan.pop()
		}
		var w_videoStr = JSON.stringify($scope.w_traVideoImg);
//		console.log(w_videoStr)
		var w_videoNameStr = JSON.stringify($scope.w_traVideoName);
//		console.log(w_videoNameStr)
        var w_chanList = JSON.stringify($scope.w_chan) ;
		localStorage.setItem('w_videoList',w_videoStr);
		localStorage.setItem('w_videoNameList',w_videoNameStr);
		localStorage.setItem('w_channelList',w_chanList);
	}
})


    























